package com.info.zhiduoduo.weixin.controller;

import com.info.zhiduoduo.common.annotation.LogEntity;
import com.info.zhiduoduo.common.annotation.LogParameter;
import com.info.zhiduoduo.common.annotation.ZddLog;
import com.info.zhiduoduo.common.constants.SmartResult;
import com.info.zhiduoduo.common.constants.system.ZddLogType;
import com.info.zhiduoduo.common.formbean.BaseSimpleFormBean;
import com.info.zhiduoduo.repository.entity.value.ValueServe;
import com.info.zhiduoduo.weixin.formbean.value.QueryValueFormBean;
import com.info.zhiduoduo.weixin.formbean.value.SaveValueFromBean;
import com.info.zhiduoduo.weixin.service.ValueService;
import io.swagger.annotations.Api;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@Api(tags = "微信端增值服务")
@RestController
@RequestMapping("/value")
public class ValueServeController {


    @Resource
    private ValueService valueService;



    /**
     * 查询 微信端/企业端 服务类型
     * @return
     */
    @PostMapping("/getServeTypeList")
    public SmartResult queryServeTypeList(@RequestBody BaseSimpleFormBean<Integer> baseSimpleFormBean){
        return valueService.queryServeTypeList(baseSimpleFormBean);
    }


    /**
     * 查询 企业/客户 的 增值服务列表
     * @return
     */
    @PostMapping("/queryCompanyServeList")
    public SmartResult queryValueServeList(@Validated @RequestBody BaseSimpleFormBean<QueryValueFormBean> baseSimpleFormBean){
        return valueService.queryValueServeList(baseSimpleFormBean);
    }


    /**
     * 添加/编辑  增值服务
     */
    @ZddLog(type = ZddLogType.CREATE,name = "审核操作",entities = @LogEntity(entity = ValueServe.class,parameters =
    @LogParameter(fields = "id",parameters = "formBean.reqdata.id")))
    @PostMapping("/addOrEditValueServe")
    public SmartResult addOrEditValueServe(@RequestBody BaseSimpleFormBean<SaveValueFromBean> baseSimpleFormBean){
        return valueService.addOrEditValueServe(baseSimpleFormBean);
    }






}
